A numerical control apparatus performs return to origin to precisely grasp the origin on a machine coordinate system in the numerical control apparatus.
As a method of the return to origin, a technique for placing a limit switch for deceleration (dog) in the vicinity of the origin of a machine moving part is available. In the technique, when the machine moving part steps on the dog, a deceleration command is given to a servomotor and a shift is made by the origin shift amount of the difference between the origin and the grid position from the point in time at which the first grid position is reached leaving the dog, thereby stopping the movement of the shaft. The grid is based on a Z phase pulse output every revolution from an encoder placed in the servomotor.
FIG. 6 is a drawing to describe the return-to-origin processing method of the dog technique. In the figure, numeral 131 denotes a dog, numerals 132, 133, and 134 are grids, numeral 135 denotes an origin shift amount, and numeral 136 denotes a distance remote from the dog to the first grid and adding the origin shift amount 135. As the origin shift amount 135, a previous measurement value is preset in parameter memory of the numerical control apparatus as a parameter.
At time t1 at which the machine moving part steps on the dog 131, a deceleration command is given to the servomotor for once stopping and then a move is started at sufficiently low speed (creep speed). When the dog 131 is left at time t2, a distance 136 of adding the distance from the position where the dog 131 is left to the first grid 133 and the origin shift amount 135 is calculated and the shaft move is stopped at the position. Accordingly, the shaft can be stopped precisely at the origin.
FIGS. 7 and 8 are drawings to describe a return-to-origin processing method in a related art in a numerical control apparatus for controlling a machine tool having a master shaft and a slave shaft (a machine having the two moving shafts placed in parallel and separate servomotors for driving one of the shafts as the master shaft and the other as the slave shaft in the same direction).
In FIG. 7, numeral 1 denotes a machine operation panel, numeral 2 denotes a move command vector distribution means, numeral 3 denotes return-to-origin processing means of the master shaft, numeral 4 denotes acceleration/deceleration means of the master shaft, numeral 5 denotes a drive section of the master shaft, numeral 6 denotes a servomotor of the master shaft, numeral 12 denotes a dog of the master shaft, numeral 15 denotes an encoder of the master shaft, numeral 7 denotes return-to-origin processing means of the slave shaft, numeral 8 denotes acceleration/deceleration means of the slave shaft, numeral 9 denotes a drive section of the slave shaft, numeral 10 denotes a servomotor of the slave shaft, numeral 13 denotes a dog of the slave shaft, numeral 16 denotes an encoder of the slave shaft, and numeral 17 denotes a parameter storage area for storing the origin shift amount, etc.
A return-to-origin command input through the machine operation panel 1 is sent to the move command vector distribution means 2, which then outputs move commands to the master shaft and the slave shaft. At this time, the move commands given to the master shaft and the slave shaft are set to have the same return-to-origin speed parameters are, for example. When a dog on signal is input from the dog 12, the return-to-origin processing means 3 of the master shaft cancels the move command of the master shaft and causes the master shaft to start to move at creep speed after stop with deceleration. When the dog is turned off (a limit switch leaves the dog), the return-to-origin processing means 3 acquires the distance to the current nearest grid from the encoder 15, moves the master shaft at creep speed at the distance of the distance from the dog off position to the nearest grid plus the origin shift amount of the master shaft stored in the parameter storage area 17 as the final move distance, and stops the master shaft when the master shaft has been moved at the move distance.
On the other hand, as for the slave shaft, when a dog on signal is input from the dog 13 to the return-to-origin processing means 7 of the slave shaft independently of the master shaft, the return-to-origin processing means 7 cancels the move command of the slave shaft and causes the slave shaft to start to move at creep speed after stop with deceleration. When the dog is turned off (limit switch leaves the dog), the return-to-origin processing means 7 acquires the distance to the nearest grid from the encoder 16, moves the slave shaft at creep speed at the distance of the distance from the dog off position to the nearest grid plus the origin shift amount of the slave shaft stored in the parameter storage area 17 as the final move distance, and stops the slave shaft when the slave shaft has been moved at the move distance.
By the way, in the numerical control apparatus for controlling the machine tool having the master shaft and the slave shaft, the origins of the shafts need to be made parallel. If return to origin is executed in a state in which the dogs 12 and 13 of the master shaft and the slave shaft are shifted in position, the move speed of the master shaft and that of the slave shaft are placed out of synchronization and thus the dogs 12 and 13 of the master shaft and the slave shaft need to be attached to parallel positions.
FIGS. 8a and 8b are drawings to describe this point in detail. FIG. 8a is a drawing to represent the positional relationship between the grids and the dogs of the master shaft and the slave shaft. FIG. 8b is a drawing to show the speed and time when return to origin is made when the grids and the dogs are at positions as in FIG. 8a. 
In FIG. 8b, the vertical axis indicates the speed and the horizontal axis indicates the time.
In FIG. 8a, numerals 50, 51, and 52 denote grids of the master shaft, numerals 53, 54, and 55 denote grids of the slave shaft, numeral 63 denotes the grid position shift amount between the master shaft and the slave shaft, numeral 64 denotes the dog position shift amount between the master shaft and the slave shaft, numeral 56 denotes the origin shift amount of the master shaft, numeral 57 denotes the origin shift amount of the slave shaft (the distance between the grid 54 and origin 59), numeral 58 denotes the origin of the master shaft, and numeral 59 denotes the origin of the slave shaft.
To execute return to origin, as in FIG. 8b, the master shaft steps on the dog at time TM1 and is decelerated. After completion of the deceleration, the master shaft enters creep speed at time TM2. On the other hand, the slave shaft steps on the dog at time TS1 and is decelerated. After completion of the deceleration, the slave shaft enters creep speed at time TS2. If the dogs of the master shaft and the slave shaft are shifted in position as shown in the figure, when return to origin is executed, the speeds of the master shaft and the slave shaft are not synchronized between the times TM1 and TS2.
Thus, in the related art, the dogs of the shafts need to be attached to parallel positions as much as possible, namely, the dog position shift amount 64 shown in FIG. 8a needs to be set to almost 0 and it is very difficult to adjust it.
A related art to the invention is disclosed in JP-A-8-22313. In the related art, the grid position shift amount between a master shaft and a slave shaft is calculated, the return-to-origin operation is performed based on a preset grid shift amount for the master shaft, and the return-to-origin operation of the master shaft and the slave shaft is performed based on the value resulting from adding grid shift amount and the position shift amount for the slave shaft, whereby the return-to-origin operation of the master shaft and the slave shaft is performed to precise positions.
However, in the return-to-origin method in the related art, if the number of dogs is one, a defective condition of the possibility of return to one-grid erroneous origin position may occur depending on the positional relationship between the master shaft and the slave shaft when the power is turned on.
FIGS. 9 and 10 are drawings to show the above-mentioned defective condition.
In FIG. 9, numeral 90 denotes the position of the master shaft after the dog is turned off, numeral 91 denotes the position of the slave shaft after the dog is turned off, numerals 101 and 102 denote grids of the master shaft, numerals 103 and 104 denote grids of the slave shaft, and numerals 110 and 111 denote the origin shift amounts of the master shaft and the slave shaft. The original shift amounts of the master shaft and slave shaft 110 and 111 are set to the same values. Numeral 112 denotes the grid position shift amount between the master shaft and the slave shaft, and numerals 120 and 121 denote the origins of the master shaft and the slave shaft.
If the positional relationship between the master shaft and the slave shaft after the dog is turned off is the positional relationship of 90 and 91 as in FIG. 9, the first grids of the shafts after the dog is turned off are 101 and 103. Therefore, the master shaft stops at the position shifted by the origin shift amount 110 from the grid 101 and the slave shaft stops at the position shifted by the grid position shift amount 112 between the master shaft and the slave shaft plus the origin shift amount 111 from the grid 103; the shafts return to the origins at parallel positions.
However, if the positional relationship between the master shaft and the slave shaft after the dog is turned off is the positional relationship of 92 and 93 as in FIG. 10, the first grids of the shafts after the dog is turned off become 101 and 104.
Thus, the master shaft stops at the position shifted by the origin shift amount 110 from the grid 101 and the slave shaft stops at the position shifted by the grid position shift amount 112 between the master shaft and the slave shaft plus the origin shift amount 111 from the grid 104.
Therefore, one-grid shift occurs between the origin 120 of the master shaft and the origin 121 of the slave shaft and the shafts cannot return to the origins at parallel positions; there is the possibility of destroying the machine.